<% @page_title = "New Account" %>
<div class="form_container column span-16 prepend-7 append-1 last">
  <h3>New User Registration</h3>
  <% form_for :user, :url => users_path do |f| -%>

    <%= sourdough_error_messages_for 'user' %>
    <% @job = @user.jobs.first %>
    <%= sourdough_error_messages_for :job %>

    <p class="key">All fields are required.</p>

    <dl class="inline">
      <dt><%= label_for :user, :username %></dt>
      <dd><%= f.text_field :login, :class => 'autofocus' %>
      <em class="constraint">3 characters or more</em>
      </dd>

      <dt><%= label_for :user, 'First Name' %></dt>
      <dd><%= f.text_field :first_name %>
      </dd>

      <dt><%= label_for :user, 'Last Name' %></dt>
      <dd><%= f.text_field :last_name %>
      </dd>

      <dt><%= label_for :user, :email %></dt>
      <dd><%= f.text_field :email %></dd>

      <dt><%= label_for :user, :password %></dt>
      <dd><%= f.password_field :password %>
      <em class="constraint">4 characters or more</em>
      </dd>

      <dt><%= label_for :user, 'Confirm Password' %></dt>
      <dd><%= f.password_field :password_confirmation %>
      <em class="constraint">4 characters or more</em>
      </dd>
    </dl>
    <hr />
    <dl class="inline">
      <% fields_for :job, @user.jobs.first do |f| %>

        <dt><%= label_for :user, 'Current Position' %></dt>
        <dd><%= f.text_field :position %></dd>

        <dt><%= label_for :user, 'Institution' %></dt>
        <dd><%= f.text_field :institution %></dd>

        <dt><%= label_for :user, 'Department' %></dt>
        <dd><%= f.text_field :department %></dd>

        <dt><%= label_for :user, 'Start Date' %></dt>

        <dd>
        <%= select_month @job.start_date, :field_name => 'start_month', :prefix => 'job', :include_blank => true %>
        <%= select_year @job.start_date, :start_year => Time.now.year, :end_year => 1900, :field_name => 'start_year', :prefix => 'job', :include_blank => true %>
        </dd>

        <dt><%= label_for :user, :city %></dt>
        <dd><%= f.text_field :city %></dd>

        <dt><%= label_for :user, :state %></dt>
        <dd><%= f.text_field :state %></dd>
      <% end %>
    </dl>
    <hr />
    <p><%= submit_tag "Register!", :class => "submit" %></p>
  <% end %>
</div>
